<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

// any_in_array() is not in the Array Helper, so it defines a new function

function checkbox_tag($name , $domain , $val){
	$CI =& get_instance();
	$items = $CI->config->item($domain);
	$tag = '';
	foreach($items as $key => $value){
		$checked = in_array($key, $val) ? 'checked':'';
		$tag = $tag.'<input type="checkbox" value= "'.$key.'" id="'.$name.'" name = "'.$name.'[]" '.$checked.' >'
				.'<label for="'.$name.'">&nbsp;'.$value.'</label> &nbsp;';
	}
	return $tag;
}